import './App.css';
import React, {Component} from 'react';
import Music from './components/Music'
import wyy from './models/wyy'
class App extends Component {
  constructor(props) {
    super(props);
    this.state = { 
      musics:[]
    }
  }
  async componentDidMount(){
    const res = await wyy.huayu();
    this.setState({
      musics:res.data.playlists
    })
    console.log(res);
  }
  render() { 
    // for循环DOM(组件)
    const lists = this.state.musics.map(item=>{
      return (<Music data={item} key={item.name}></Music>);
    })
    return <div className="music">{lists}</div>
  }
}

export default App;
